function get(url, data = {}) {
  const searchData = new URLSearchParams(data).toString();
  return fetch(url + "?" + searchData).then((res) => res.json());
}
function post(url, data = {}) {
  return fetch(url, {
    method: "post",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(data),
  }).then((res) => res.json());
}

export const http = { post, get };
